home *** CD-ROM | disk | FTP | other *** search
/ Power Tools for Macintosh / Power Tools for Macintosh (SoftBit)(1992).iso / Applications / BNDL Banger / Read Me - BNDL Banger v.1.2 < prev   
Text File  |  1991-12-24  |  19KB  |  146 lines

  1. BNDL Banger v.1.2
  2. © Copyright Tim Swihart
  3. December 23, 1991
  4. All Rights Reserved
  5.  
  6.  
  7. (special note:  BNDL Banger v.1.2 supports _ALL_ files that have a bundle!  So, substitute your favorite "file with a BNDL" anywhere in the text below that implies only 'APPL' files are supported.  Rewording each instance of "application" in the rest of this file makes reading it rather cumbersome, so I left it alone and added this note.)
  8.  
  9. BNDL Banger v.1.2 is FreeWare - I retain all rights to it, but place no restrictions on distribution.  BNDL Banger v.1.2 may be distributed freely (even by the folks that sell disks full of shareware for higher-than-I-think-they-should-be prices) as long as this "Read Me" file is included.
  10.  
  11. BNDL Banger was compiled and linked under Symantec's Think C v.5.0.1, so some parts of BNDL Banger are probably copyright Symantec.  I'm laying no claim to rights that would infringe on their rights.  The only rights I'm claiming are on the unique code I wrote.
  12.  
  13. BNDL Banger is loosely based on the "Super Skeleton" source code that comes with the disk for Addison-Wesley's "Programming for System 7" (which I co-wrote along with Gary Little and which you should buy if you don't already have it).  The use of Super Skeleton's source is with express permission of Gary Little and simplified the creation of some parts of BNDL Banger.
  14.  
  15. BNDL Banger is intended to be used under System 7.0 or newer.  BNDL Banger is "System 7 Dependent" and can _NOT_ work under System 6.0.x or any version of the System that was released prior to System 7.0 (so don't even bother to try unless you're really bored).  Why can't BNDL Banger work under pre-System 7.0?  Because some of the key traps called by BNDL Banger didn't exist prior to System 7.0 (like PBDTRemoveAPPL).
  16.  
  17. If you do try to run BNDL Banger v.1.2 under pre-System 7 versions of Macintosh System Software, BNDL Banger figures out what you're trying to do, puts up a dialog reminding you it doesn't work without at least System 7, and quits after you dismiss the dialog.  That's a lot friendlier than how BNDL Banger v.1.0 handled the situation (it bombed, requiring the user to restart the machine, because it was trying to access System 7's Help menu BEFORE it verified it was running under System 7 — but that's fixed in v.1.1 and v.1.2).
  18.  
  19. BNDL Banger, as the name implies, bangs BNDL resources.  Simply put, it provides an easier way to update an application's BNDL information in a volume's desktop database.  Just drag & drop the desired application onto BNDL Banger's icon and that application's BNDL information will be slammed into the desktop database of the volume on which the selected application exists.  The next time you reboot, that new BNDL information will be used instead of whatever old BNDL information it had (along with whatever new icons you defined for your application, its documents, its editions, etc.).
  20.  
  21. This is generally much more convenient, and far less error prone, than rebuilding the volume's desktop (especially considering that rebuilding the desktop doesn't always produce the desired results - see below for more details).
  22.  
  23. You can also select the application whose BNDL you want to "bang" via the "Banger" menu (there's only one item in that menu, so it's real easy to find the right item).  If you go this route, you'll be presented with the standard open file dialog that only shows applications, folders, and volumes.  Navigate to the application whose BNDL you want to bang and click on the "Open" button.  If the application's BNDL is successfully "banged", you'll be presented with a dialog confirming the action and reminded that you'll need to reboot in order to see the results (sorry, no clean way to avoid the reboot, best I can do is let you avoid rebuilding the desktop).
  24.  
  25. You only get the dialog confirming the "banging" (and reminding you to reboot) if you used the "Banger" menu to select the application whose BNDL you want banged.  If you use the "drag & drop" approach, then the dialog is suppressed (makes it easier to keep BNDL Banger running in the background without forcing you to bring it to the foreground and dismiss a dialog every time you want to bang a BNDL).
  26.  
  27. Regardless of which approach you take (menu vs. "drag & drop"), you'll get at least one beep if the operation worked.  I know, I know, beeps are supposed to indicate errors, not success, but it's was the simplest way to provide some kind of simple confirmation of success when you're just leaving BNDL Banger running in the background.  If there are multiple copies of applications with the same creator type as the incoming application's, then they're all removed from the desktop (this is part of why BNDL Banger v.1.2 is more reliable at "banging" than v.1.0 was).
  28.  
  29. Each time an application is removed from the desktop database, BNDL Banger beeps.  If you have three copies of an application, the first time you run BNDL Banger v.1.2 on that application, you'll hear three beeps.  The next time you run BNDL Banger v.1.2 on that application, you may well only hear _ONE_ beep, that's normal (remember, we removed the other three copies, but _ONLY_ the application you passed into BNDL Banger is added back into the desktop database, the others are no longer in it unless you rebuild the desktop on that volume).
  30.  
  31. If you try to bang an application twice in a row, without rebooting in between, it's possible that its BNDL information will not yet have been added back into the desktop database, so the PBDTRemoveAPPL will fail and you won't get a confirmation of success.  Don't panic, just reboot (like you should have after the first time you banged the application's BNDL) and all should work just fine again.
  32.  
  33. Before I go any further, let me explain just exactly what I mean by "banging" an application's BNDL.  Under System 7, volumes with at least 2 megs on them have a desktop database instead of the old desktop resource file.  System 7 provides traps that let applications work with the desktop database if they really need to (BNDL Banger really needs to).  So, when an application has been selected for "banging", BNDL Banger calls PBDTRemoveAPPL on the desktop database that's on the same volume as the application being banged.  Then, the "hasBeenInited" bit in the application's Finder Info is cleared and written back to the application's volume.  This tricks the System into thinking it's never before seen this application (since it has no record of it in the desktop database) and the application hasn't been inited (because we cleared its "hasBeenInited" bit), so the System extracts the BNDL information (and related resources - 'FREF', ICN#', etc.) and adds it to that volume's desktop database.
  34.  
  35. NOTE:  In order for the Finder to "notice" your application has been banged, you'll need to open the window that contains your application.  Otherwise, the "hasBeenInited" bit will stay clear for quite some time.  Since BNDL Banger is intended for use with application's you're developing, I don't see this as a problem worth solving (you'll be working in the same folder as your app anyways most likely, so it'll be open and all will be well with the world).
  36.  
  37. Without a tool like BNDL Banger, it's a "hit or miss" proposition, with lots of hidden "gotcha's" as you try to make new versions of application/document icons show up, make new foreign file types work properly with "drag & drop", or make any BNDL-related changes take effect.
  38.  
  39. The Finder seems to cache the information from the desktop database, so you won't see the new information until you reboot.  Do _NOT_ rebuild your desktop when you reboot!  Rebuilding your desktop can cause the BNDL information from a DIFFERENT copy of your application (if you have more than one copy hanging around) to be used for the volume's desktop database (the first file with a given creator type that's found is the one that's used for the desktop database during a rebuild which is one of the major stumbling blocks that gets in the way of cleanly updating your application's BNDL-related information...).
  40.  
  41. Floppies have less than 2 megs of storage space, so they do NOT have a desktop database and you can NOT "bang" applications that live on floppies.  You can try, but BNDL Banger checks the target volume for the presence of a desktop database and ONLY calls PBDTRemoveAPPL if there is a desktop database...
  42.  
  43. Since floppies don't have a desktop database, drag & drop won't work if BNDL Banger is on a floppy (that's the System's fault not mine).  So, keep BNDL Banger on a hard drive (or some other volume with more than 2 megs of storage space).
  44.  
  45. If you have multiple volumes online, then you CAN run into some situations where BNDL Banger will appear not to have worked even though you got a confirmation dialog that said it did work and even though you remembered to reboot after banging your application's BNDL.  To understand why, let's pretend your application being developed is on your non-boot drive and that you have a "spare" copy of it on your boot drive.  You change your application's icon (or make some other BNDL-related change) and run your application through BNDL Banger.  Even after rebooting, you'll still see the old BNDL information because the System uses the FIRST occurrence of your application's signature it comes across - which in this case is the older version of your application that happens to be on your boot volume.
  46.  
  47. The best way to handle this is only have one drive online that has more than 2 megs of storage (which is what most people will have).  The next best way to handle this is to keep your application _ONLY_ on one volume and NEVER let it exist (not even briefly) on the other volume.  That way, its BNDL information will never be added to the other volume's desktop database and you won't get the conflict mentioned in the paragraph above.
  48.  
  49. If your application is ever copied to your "other" drive, you'll need to remove it (and any documents bearing your application's creator type) and rebuild it's desktop.  Fun, eh?  Can't blame that hassle on 'BNDL Banger', the System's always sort of been this way (and it's just this sort of hassle that drove me to write BNDL Banger).
  50.  
  51. The "multi—volume" problem is solved in "BNDL Banger Pro" (which is available for $7, see the ordering information near the end of this file for details).
  52.  
  53. Like all good System 7 applications, BNDL Banger includes Balloon Help for all the key items (menus, menu items, major parts of its dialogs, etc.).  It even adds a "tutorial" item to the Help menu (the one on the right hand side of the menu bar that looks like a help balloon with a question mark in the middle of it) - the tutorial item presents a simple dialog full of quick reminders about what BNDL Banger does and how to use it.  (Heck, I wrote the "Balloon Help" chapter of "Programming for System 7", so I'd better put balloons in other stuff I write...).
  54.  
  55. System 7's "drag & drop" apparently wasn't expecting any application to ever want to allow ONLY other applications to be supported as "foreign documents".  As a result, the only way to get "drag & drop" to work when you drag another application icon on top of BNDL Banger's icon is to specify the wildcard ('****') foreign file type.  While this does allow application icons to be "dropped" on top of BNDL Banger's icon, it also allows (and there's no way to prevent this) ANY other icon (except folder icons and disk icons) to be dropped on top of BNDL Banger's icon and BNDL Banger will be launched as a result.  So, I had to add a couple of lines of code to verify the incoming file has it's "hasBundle" Finder info flag set (documents don't have a BNDL to bang, so no sense supporting them).  If the incoming file doesn't have that bit set, then BNDL Banger simply ignores it and exits.  Since no banging was done, no confirmation beep is sounded.
  56.  
  57. Before I wrote BNDL Banger, I mentioned the need for such a utility to a friend of mine who immediately said, "Oh, I wrote one of those while I was in Japan...".  To which I naturally said, "Great, can I have a copy of it?".  While he agreed to send me a copy of it, the copy never arrived, so I wrote my own (I always wanted to write my own and this was as good of an excuse as any other).  So, somewhere in the world, another similar application exists (and existed before BNDL Banger), but as of the time I'm writing this, I haven't yet seen it...
  58.  
  59. Because it was fairly simple to write, because a similar tool already existed, because it's something I would have done for myself anyway, because I was already very familiar with the desktop database, and because I'm such a nice guy (and so modest too), I'm releasing BNDL Banger v.1.2 as FreeWare.  However, in the interest of making a buck (hey, I live in America, I'm supposed to be enterprising...), the source code (in Think C v.5.0.1  and Rez/SARez format) is available on one 800K disk for seven dollars ($7, U.S. currency please).  Send your check or money order (the U.S. Post Office discourages sending cash through the mail and I really don't blame them).  Send your money to:
  60.  
  61. Tim Swihart
  62. P.O.Box 160643
  63. Cupertino, CA  95016
  64.  
  65. To sweeten the deal ("Seven bucks for a lousy floppy?"), I'll toss in a more powerful version of BNDL Banger (known as "BNDL Banger Pro" for lack of a better name) and the source code for both BNDL Banger and BNDL Banger Pro.
  66.  
  67. BNDL Banger Pro was completed _BEFORE_ BNDL Banger v.1.2 (which means you can order BNDL Banger Pro now) and has the following additional features:
  68. • Preferences Menu allowing user to control:
  69. - Whether or not a beep is sounded in confirmation of a successful banging (if the beep bugs you, turn it off).
  70. - Whether a custom sound (one I created) or your regular system beep is used when confirming success.  This makes it easier to tell BNDL Banger Pro's beeps apart from other beeps.
  71. - Whether or not the confirmation dialog is displayed when using BNDL Banger Pro interactively (i.e.:  via the "Banger" menu instead of via drag & drop).
  72. - Whether all online volumes are banged or just the volume containing the incoming file.
  73. - Auto-quit time (see below).
  74. • Multiple auto-quit times to select from.  This allows you to have BNDL Banger Pro quit for you when it's running in the background.  Default times are one minute, ten minutes, and one hour.  Naturally, a "Don't Auto-quit" option is available.  Since source code is included with BNDL Banger Pro, it's fairly simple to change the default times to whatever you prefer they be.
  75. • Preferences are written to your boot disk (in the Preferences folder of course) and automatically used each time BNDL Banger Pro is launched.  This lets you run BNDL Banger Pro interactively one time, set up an auto-quit time (and other preferences) and those preferences will be used, even when just using drag & drop, each time BNDL Banger Pro is launched.
  76. • There's an option to restore the default preferences (default = my personal preferences that I built in).
  77.  
  78.  
  79. Feel free to suggest other features, but bear in mind that your seven bucks gets you the source code as well, so I may suggest that you be the one to implement some of your suggestions.
  80.  
  81. My source code is fairly heavily commented, the comments are written at the same time the source is, not later on when I've half forgotten what the source is doing (I'm one of those sicko programmers that comments their code literally as the code is written - like they always try to teach you to do in college, but most folks never really listen...).  That means it should be real easy to figure out what I did and add features of your own.
  82.  
  83. BNDL Banger is Apple event aware (required events only), so you could conceivably send it an Apple event telling it to bang an application for you (just send an 'odoc' event like the Finder does).  Not many developers are likely to care about this, but if you happen to be working on developer tool-related applications/environments...  Besides, you could send a 'quit' event to force BNDL Banger to quit without having to bring it to the foreground, select Quit from the File menu, etc.
  84.  
  85. To report bugs, send suggestions, or offer constructive criticism, I can be reached at any of the following:
  86.  
  87. GEnie:  Tim.Swihart
  88. America Online:  A2Pro Tim
  89. AppleLink:  Tim.Swihart
  90. Snail mail:  Tim Swihart
  91.                    P.O.Box 160643
  92.                    Cupertino, CA  95016
  93.  
  94.  
  95. Enjoy BNDL Banger!
  96. Tim S.
  97.  
  98. ---------- Revision History ----------
  99.  
  100. Changes since version 1.1:
  101.     • Version number bumped to 1.2.
  102.  
  103.     • Renamed "Bang Application…" item in "Banger" menu to "Bang Something…".  This 
  104.       better reflects the fact that BNDL Banger now handles more than just applications
  105.       (since more than just applications are likely to have a BNDL resource).  Potential
  106.       items to bang are filtered in the StandardGetFile dialog based on whether or not
  107.       their "hasBundle" is set - if it's set, they show up in the StandardGetFile 
  108.       dialog.  If it's NOT set, and you're using drag & drop, the file is simply ignored.
  109.       Credit for this idea goes to a fellow developer (thanks for the idea Cory!).
  110.  
  111.     • Tweaked some balloon messages for clarity.  All of these changes are in
  112.       the Balloons.r file.
  113.  
  114.     • Reworded some of the text in the About box and the "tutorial" dialogs to reflect
  115.       the fact that BNDL Banger Pro can bang any file with a bundle instead of just
  116.       applications.
  117.     
  118.     • Added call to InitCursor() when resuming after being sent to background.  This 
  119.       fixed the problem where you would occassionally have the wrong mouse pointer in
  120.       BNDL Banger and BNDL Banger Pro.
  121.     
  122.     • Tweaked amount of RAM requested for "preferred" and "minimum" size partitions
  123.        under MultiFinder (we now use 60K, we could probably get by with less, so try 
  124.       less if your system is tight on memory).
  125.  
  126.  
  127. Changes since version 1.0:
  128.     • Fixed crash when launching under pre-System 7.0.  The check for whether or not
  129.        we're running under System 7 was being done AFTER trying to append an item to
  130.        the Help menu, so I swapped the order of these two actions.  The only routine 
  131.        affected by this fix was "Initialize()".
  132.     
  133.     • Corrected a comment in "Initialize()" to more accurately reflect what a called
  134.        routine was expected to do for us.
  135.     
  136.     • Changed algorithm used in the "BangIt()" routine to a more reliable one.  A side
  137.        effect of this is that multiple beeps may be heard while banging an application.
  138.        Version 1.0 only called PBDTRemoveAPPL() once (for the incoming application), 
  139.        but it should have been called once for each copy of the application with the
  140.        same creator type that's found on the incoming application's volume.  Now, there's
  141.        one beep as each copy of an application is removed from the desktop database.  If
  142.        there are three copies of the application on the volume, three beeps are heard.
  143.     
  144.     • Tweaked some of the balloon messages for clarity.  All of these changes are in
  145.        the Balloons.r file.
  146.